import { Box, Flex, Button, Grid, Heading, Badge, Image, Text, } from "@teste-ui/react" import { Layout } from "../../components/Layout" import { properties } from "../../utils/sample-data" import { GetStaticProps, GetStaticPaths } from "next" import { Property } from "../../interfaces/Property" import { Chakra } from "../../Chakra" const PropertyPage = ({ item }: { item: Property }) => ( {item.title} {item.isNew && ( New )} {item.beds} beds • {item.baths} baths {item.imageAlt} {item.formattedPrice} {item.description} ) export const getStaticPaths: GetStaticPaths = async () => { // Get the paths we want to pre-render based on properties const paths = properties.map((property) => ({ params: { id: property.id }, })) // We'll pre-render only these paths at build time. // { fallback: false } means other routes should 404. return { paths, fallback: false } } export const getStaticProps: GetStaticProps = async ({ params }) => { try { const id = params?.id const item = properties.find((data) => data.id === id) // By returning { props: item }, the StaticPropsDetail component // will receive `item` as a prop at build time return { props: { item } } } catch (err) { return { props: { errors: err instanceof Error ? err.message : "unexpected error", }, } } } export default PropertyPage